<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
>
<script th:inline="javascript">
/*<![CDATA[*/
  $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
  $(function(){
	  battcn.admin.menu[[${OP.menuId}]].save = function(obj) {
		var $form = $("#menu[[${OP.menuId}]]Form");  		
  		if($form.valid()){
  			battcn.ajaxJson({url:"/op_save_[[${OP.menuId}]]",data:$form.serializeArray()},function(){
  				battcn.closeWindow();
				$('#admin_menu[[${OP.menuId}]]_datagrid').bootstrapTable('refresh');
    		});
  		}; 
	};	 
  });
/*]]>*/
</script>
<div class="ibox float-e-margins animated fadeInRight">
	<div class="ibox-content">
		<form class="form-horizontal m-t required-validate" th:id="@{menu{menuId}Form(menuId=${OP.menuId})}" method="POST" >
			<input type="hidden" name="id" th:value="${dto?.id}" />
			<div class="form-group">
				<label class="col-sm-3 control-label">姓名：</label>
				<div class="col-sm-8">
					<input name="name" class="form-control" type="text"
						th:value="${dto?.name}" validate="{required:true,messages:{required:'请填写姓名'}}"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">帐号：</label>
				<div class="col-sm-8">
					<input name="account" class="form-control" th:value="${dto?.account}"
						validate="{required:true,messages:{required:'请填写帐号'}}"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">角色：</label>
				<div class="col-sm-8">
					<select class="form-control m-b" name="roleId">
						<option value="0">请选择角色</option><p ></p>
						<option th:each="role : ${roles}" th:value="${role.id}" th:selected="${role.id == dto?.roleId} ? 'selected'" th:text="${role.name}"></option>
					</select>
				</div>
			</div> 
			<div class="form-group">
				<label class="col-sm-3 control-label">密码：</label>
				<div class="col-sm-8">
					<input name="password" id="password" class="form-control" th:value="${dto?.password}"
						validate="{required:true,minlength:4,maxlength:20,messages:{required:'请填写密码',minlength:'密码必须大于等于4',maxlength:'密码必须小于等于20'}}" type="password"/>
					<span style="color: red;" th:if="${dto?.password}">不填为则不修改密码</span>
				</div>
			</div>
			<div class="form-group" th:if="${dto?.id}">
				<label class="col-sm-3 control-label">确认密码：</label>
				<div class="col-sm-8">
					<input name="rePassword" class="form-control" type="password" th:value="${dto?.password}"
						validate="{required:true,equalTo:'#password',messages:{required:'请填写重复密码',equalTo:'两次密码输入不一致'}}"/>					
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<div class="radio i-checks radio-inline">
						<label><input type="radio" value="1" th:checked="${dto?.locked == true}" name="locked" /><i></i> 启动 </label>
					</div>
					<div class="radio i-checks radio-inline">
						<label><input type="radio" value="0" th:checked="${dto?.locked != true}" name="locked" /><i></i> 禁用 </label>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
</html>